package com.ruoyi.dataserver.line.controller;

import com.ruoyi.dataserver.line.dto.LineFileAndOperationSymbolAndValueDto;
import com.ruoyi.dataserver.line.service.LineService;
import com.ruoyi.dataserver.utils.R;
import com.ruoyi.dataserver.service.ISearchTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @ProjectName intelligent-city
 * @Package com.lab.dataserver.line.controller
 * @ClassName LineController
 * @Description 管线
 * @Company lab
 * @Author zgq
 * @Date 2020/7/6 10:58
 * @UpdateUser
 * @UpdateDate
 * @UpdateRemark
 * @Version 1.0.0
 */
@RestController
@RequestMapping("line")
public class LineController {

    @Autowired
    LineService lineServiceImpl;

    @Autowired
    public ISearchTableService tableService;

    /**
     * @param layer   : 图层
     * @param current : 页数
     * @param size    : 每页条数
     * @param lov     : 字段 运算符号 值
     * @return com.lab.dataserver.utils.R
     * @Title pageSelect
     * @Description 管线分页查询
     * @author zgq
     * @date 2020/7/6 10:59
     * @UpdateUser
     * @UpdateDate
     * @UpdateRemark
     */
    @RequestMapping(value = "pageSelect/{layer}/{current}/{size}", method = RequestMethod.POST)
    public R pageSelect(@PathVariable("layer") String layer,
                        @PathVariable("current") Long current,
                        @PathVariable("size") Long size,
                        @RequestBody List<LineFileAndOperationSymbolAndValueDto> lov) {

        return R.ok(lineServiceImpl.pageSelect(tableService.searchLineTable(layer), lov, current, size));
    }

    /**
     * @param layer   : 图层
     * @param current : 页数
     * @param size    : 每页条数
     * @param lov     : 字段 运算符号 值
     * @return com.lab.dataserver.utils.R
     * @Title pageSelect2
     * @Description 关键字查询
     * @author zgq
     * @date 2020/7/6 10:59
     * @UpdateUser
     * @UpdateDate
     * @UpdateRemark
     */
    @RequestMapping(value = "pageSelect2/{layer}/{current}/{size}", method = RequestMethod.POST)
    public R pageSelect2(@PathVariable("layer") String layer,
                         @PathVariable("current") Long current,
                         @PathVariable("size") Long size,
                         @RequestBody List<LineFileAndOperationSymbolAndValueDto> lov) {
        return R.ok(lineServiceImpl.pageSelect2(tableService.searchLineTable(layer), lov, current, size));
    }

    /**
     * @param layer   : 图层
     * @param current : 页数
     * @param size    : 每页条数
     * @param lov     : 字段 运算符号 值
     * @return com.lab.dataserver.utils.R
     * @Title pageSelect4
     * @Description 关键字查询
     * @author zgq
     * @date 2020/7/6 10:59
     * @UpdateUser
     * @UpdateDate
     * @UpdateRemark
     */
    @RequestMapping(value = "pageSelect4/{layer}/{current}/{size}", method = RequestMethod.POST)
    public R pageSelect4(@PathVariable("layer") String layer,
                         @PathVariable("current") Long current,
                         @PathVariable("size") Long size,
                         @RequestBody List<LineFileAndOperationSymbolAndValueDto> lov) {
        return R.ok(lineServiceImpl.pageSelect4(tableService.searchLineTable(layer), lov, current, size));
    }

    /**
     * @param layer   : 图层
     * @param current : 页数
     * @param size    : 每页条数
     * @param lov     : 字段 运算符号 值
     * @return com.lab.dataserver.utils.R
     * @Title pageSelect3
     * @Description 管径查询
     * @author zgq
     * @date 2020/7/6 10:59
     * @UpdateUser
     * @UpdateDate
     * @UpdateRemark
     */
    @RequestMapping(value = "pageSelect3/{layer}/{current}/{size}", method = RequestMethod.POST)
    public R pageSelect3(@PathVariable("layer") String layer,
                         @PathVariable("current") Long current,
                         @PathVariable("size") Long size,
                         @RequestBody List<LineFileAndOperationSymbolAndValueDto> lov) {
        return R.ok(lineServiceImpl.pageSelect3(tableService.searchLineTable(layer), lov, current, size));
    }
}
